{% extends "_layouts/docs.html" %}

{% block title %}Search results{% if query %} for "{{query}}"{% endif %}{% endblock %}

{% block content_title %}
  {% if results and results.entries %}
    <h1 class="p-heading--2">We've found these results for your search <strong>"{{ query }}"</strong></h1>
  {% else %}
    <h1 class="p-heading--2">We haven't found any results for your search <strong>"{{ query }}"</strong>.</h1>
  {% endif %}
{% endblock %}

{% block content %}
  {% if  results and results.entries %}
  <div class="p-strip is-shallow">
    {% for item in results.entries %}
      <h4><a href="{{ item.link }}">{{ item.htmlTitle | safe}}</a></h4>
      <p>
        {{ item.htmlSnippet | safe }}
      </p>
      <p><a href="{{ item.link }}">{{ item.htmlFormattedUrl | safe }}</a></p>
    {% endfor %}
  </div>

  <div class="p-strip p-article-pagination">
    {% if  results.queries and results.queries.previousPage %}
      <a
        class="p-article-pagination__link--previous"
        href="/docs/search?q={{ query }}&amp;start={{ results.queries.previousPage.0.startIndex }}{% if siteSearch %}&amp;siteSearch={{ siteSearch }}{% endif %}"
      >
        <span class="p-article-pagination__label">Previous</span>
      </a>
    {% endif %}
    {% if results.queries and results.queries.nextPage %}
      <a
        class="p-article-pagination__link--next"
        href="/docs/search?q={{ query }}&amp;start={{ results.queries.nextPage.0.startIndex }}{% if siteSearch %}&amp;siteSearch={{ siteSearch }}{% endif %}"
      >
        <span class="p-article-pagination__label">Next</span>
      </a>
    {% endif %}
  </div>
  {% endif %}
{% endblock %}
